package com.centerm.common.constant.enums.project;

import com.centerm.common.constant.StatusCode;

/**
 * @ClassName ProjectExecuteResult
 * @Description: 项目进展结果枚举类
 * @author lk
 * @date 2017年7月24日
 */
public enum ProjectExecuteResult implements StatusCode {
    
    UNFINISHED(0, "未完结"),
    NORMAL(1, "正常"),
    DELAY(2, "延期");

    private Integer code;
    private String description;
    
    private ProjectExecuteResult(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getDescription() {
        return this.description;
    }

    public static ProjectExecuteResult getByCode(Integer code) {
        for(ProjectExecuteResult result : ProjectExecuteResult.values()) {
            if(result.getCode().equals(code)) {
                return result;
            }
        }
        return null;
    }

    public static String getDescriptionByCode(Integer code) {
        for(ProjectExecuteResult result : ProjectExecuteResult.values()) {
            if(result.getCode().equals(code)) {
                return result.getDescription();
            }
        }
        return null;
    }
}
